package logic

import (
	"context"
	"srv/renrenzu"

	"api/internal/svc"
	"api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type GoodslikeLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewGoodslikeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GoodslikeLogic {
	return &GoodslikeLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *GoodslikeLogic) Goodslike(req *types.GoodslikeRequest) (resp *types.Response, err error) {
	// todo: add your logic here and delete this line
	goodslike, err := l.svcCtx.RenRenZu.Goodslike(l.ctx, &renrenzu.GoodslikeRequest{})
	if err != nil {
		return nil, err
	}

	return &types.Response{
		Msg:  "排行榜展示成功",
		Code: 200,
		Data: map[string]interface{}{"goodlike": goodslike},
	}, nil

}
